<?php

header("Content-Type:text/html; charset=gb2312");

$file_name=$_GET['file_name'];
$file_name=iconv("utf-8","gb2312",$file_name);
if(!file_exists($file_name)){ 
    echo $file_name;
    return ; 
} 
$file_size=filesize($file_name);
$file_handle=fopen($file_name,'r');

header("Content-type:"."application/gz");
header("Content-Disposition:attachment;filename=".basename($file_name));
header("Cache-control:public");
header("Pragma:public");
header("Content-Length:".$file_size);

ob_clean();                                          //关闭缓冲
flush();

$buffer=1024;
$file_count=0;
while(!feof($file_handle)&&$file_count<$file_size){
	$realfile=fread($file_handle,$buffer);
	$file_count+=$buffer;
	echo $realfile;
}
fclose($file_handle);

?>
